/**
 * @description: SendRecordSrv
 */

import type { CommonAPI } from '../types/all'
import { defHttp } from '../http'
/** 获取证书详情 */
export const getCertApi: CommonAPI<'/v1/cert', 'get'> = params =>
  defHttp.get(`/v1/cert`, { params })

/** 删除证书 */
export const deleteCertApi: CommonAPI<'/v1/cert', 'delete'> = params =>
  defHttp.delete(`/v1/cert`, { params })

/** 查询申请结果 */
// export const getCertApplyResultApi: CommonAPI<
//   '/v1/cert/apply_result',
//   'get'
// > = params => defHttp.get(`/v1/cert/apply_result`, { params })

/** 获取cname */
export const getCertCnameApi: CommonAPI<'/v1/cert/cname', 'get'> = params =>
  defHttp.get(`/v1/cert/cname`, { params })

/** 获取证书列表 */
export const getCertListApi: CommonAPI<'/v1/cert/list', 'get'> = params =>
  defHttp.get(`/v1/cert/list`, { params })

/** 查询证书记录（更新记录） */
export const getCertRecordListApi: CommonAPI<
  '/v1/cert/record/list',
  'get'
> = params => defHttp.get(`/v1/cert/record/list`, { params })

/** 获取证书记录 */
export const getCertRecordApi: CommonAPI<'/v1/cert/record', 'get'> = params =>
  defHttp.get(`/v1/cert/record`, { params })

/** 证书详情-更新记录 */
export const getCertRecordBaseApi: CommonAPI<
  '/v1/cert/record/base-list',
  'get'
> = params => defHttp.get(`/v1/cert/record/base-list`, { params })

/** 获取申请日志 */
export const getCertRecordLogApi: CommonAPI<
  '/v1/cert/record/log',
  'get'
> = params => defHttp.get(`/v1/cert/record/log`, { params })

/** 更新证书 */
export const addCertRenewApi: CommonAPI<'/v1/cert/renew', 'post'> = data =>
  defHttp.post(`/v1/cert/renew`, data)

/** 获取服务域名 */
export const getCertServiceDomainApi: CommonAPI<
  '/v1/cert/service_domain',
  'get'
> = params => defHttp.get(`/v1/cert/service_domain`, { params })

/** 设置证书服务域名 */
export const updateDnsDomainApi: CommonAPI<
  '/v1/cert/service_domain',
  'put'
> = data => defHttp.put(`/v1/cert/service_domain`, data)

/** 获取ACME 账户 */
/** 获取ACME 账户详情 */
export const getCertAcmeApi: CommonAPI<
  '/v1/cert/acmeaccount',
  'get'
> = params => defHttp.get(`/v1/cert/acmeaccount`, { params })

/** 删除证书 */
export const deleteCertAcmeApi: CommonAPI<
  '/v1/cert/acmeaccount',
  'delete'
> = params => defHttp.delete(`/v1/cert/acmeaccount`, { params })

/** 更新证书 */
export const updateCertAcmeApi: CommonAPI<
  '/v1/cert/acmeaccount',
  'post'
> = data => defHttp.post(`/v1/cert/acmeaccount`, data)

/** 获取证书 */
export const getCertAcmeListApi: CommonAPI<
  '/v1/cert/acmeaccount/list',
  'get'
> = params => defHttp.get(`/v1/cert/acmeaccount/list`, { params })
// -----------------------------------证书域名管理-----------------------------------------------------------
/** 删除域名 */
export const deleteCertDomainApi: CommonAPI<
  '/v1/cert/resolve_domain',
  'delete'
> = params => defHttp.delete(`/v1/cert/resolve_domain`, { params })

/** 创建域名 */
export const addCertDomainApi: CommonAPI<
  '/v1/cert/resolve_domain',
  'post'
> = data => defHttp.post(`/v1/cert/resolve_domain`, data)

/** 更新域名 */
export const updateCertDomainApi: CommonAPI<
  '/v1/cert/resolve_domain',
  'put'
> = data => defHttp.put(`/v1/cert/resolve_domain`, data)

/** 查询域名 */
export const getCertDomainListApi: CommonAPI<
  '/v1/cert/resolve_domain/list',
  'get'
> = params => defHttp.get(`/v1/cert/resolve_domain/list`, { params })
